package View;

import jade.core.Agent;

import java.awt.BorderLayout;
import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

import map.Map;

public class PanelGui extends JFrame{

	public static int CELL_DIMENSION = 30;
	private static final long serialVersionUID = 1L;

	private DrawPanel paint;
	private JLabel sourceLabel = new JLabel("click a point on map;");
	public JLabel getSourceLabel() {
		return sourceLabel;
	}

	public JLabel getDestinationLabel() {
		return destinationLabel;
	}


	private JLabel destinationLabel = new JLabel("click a point on map");
	private JLabel stepnum = new JLabel("Step num");
	private JLabel carnum = new JLabel("Car num");
	private Integer listOne[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
	public JComboBox stepcombo = new JComboBox(listOne);
	public JComboBox carcombo = new JComboBox(listOne);
	private JPanel buttonBar = new JPanel(new FlowLayout());
	public JLabel performanceLabel = new JLabel("Performance Measure: ");

	public PanelGui(final Map map, final Agent a) {
		this.setLayout(new BorderLayout());
		
		JButton addCar = new JButton("Add one car");

		buttonBar.add(addCar);
		buttonBar.add(new JLabel("Source: "));
		buttonBar.add(sourceLabel);
		buttonBar.add(new JLabel("Destination: "));
		buttonBar.add(destinationLabel);
		buttonBar.add(new JLabel("Custom: "));
		buttonBar.add(stepnum);
		buttonBar.add(stepcombo);
		buttonBar.add(carnum);
		buttonBar.add(carcombo);
		

		paint = new DrawPanel(this,map, a);
		paint.setSize(map.getSize() * CELL_DIMENSION, map.getSize()* CELL_DIMENSION);

		this.add(buttonBar, BorderLayout.NORTH);
		this.add(paint, BorderLayout.CENTER);
		this.add(performanceLabel, BorderLayout.EAST);
		this.setSize(map.getSize() * CELL_DIMENSION + 500, map.getSize()* CELL_DIMENSION + 100);
	}

	public JPanel getDrawPanel() {
		return paint;
	}
	
	
	public JPanel getButtonBar() {
		return buttonBar;
	}
}
